#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <lrc.h>
#include  <QListWidgetItem>

#define N 10

//extern Lrc::S_LRC_HEAD;

namespace Ui {
class Widget;
}

class Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = 0);
    explicit Widget(int fd0,QWidget *parent = 0);
    ~Widget();

    int pipe_fds[2];
    int fifo_fd;
    int f_s;
    int display_flag;

    FILE* fp;
    list<lrc>* lrc_list;
    char * songs[N] = {NULL};
    int song_num;
    int song_index;
    QListWidgetItem * qList_items[N];
    S_LRC_HEAD* lrc_head;





    // get song name list
    void get_song_name_list();

    // recv the mplayer output
    void* recv_msg(void * arg);

    // continue send msg to mplayer
    void* send_msg(void* arg);




    void myslot(QString str);

    void volume_remove(QPixmap pixmap);


    void action(QPixmap pixmap);
    void volume_change(int value);
    void myslot_up();
    void myslot_down();
    void get_time(int time);



private slots:


    void on_pushButton_display_clicked();

    void on_pushButton_pause_clicked();

    void on_pushButton_display_lrc_clicked();

    void on_pushButton_find_lrc_with_time_clicked();

    void on_listWidget_song_itemDoubleClicked(QListWidgetItem *item);

signals:
    void gettime(float time);s

private:
    Ui::Widget *ui;
};

#endif // WIDGET_H
